package com.ujson.uaa.persistence;

import com.ujson.base.persistence.BaseDo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Data
@ApiModel("角色表")
@Entity
@Table(name = "t_role")
public class RoleDo extends BaseDo {

    @ApiModelProperty("父级角色")
    @Column(name = "parent_id")
    private Long parentId;

    @ApiModelProperty("角色英文名称")
    @Column(name = "enname")
    private Long enname;

    @ApiModelProperty("角色关联的资源")
    @OneToMany
    @JoinTable(name = "t_role_permission", joinColumns = @JoinColumn(name = "r_id"), inverseJoinColumns = @JoinColumn(name = "p_id"))
    private List<PermissionDo> permissions;

}
